#!/bin/bash
# --------------------------------------------------
#Author:  LJ
#Email:   admin@attacker.club

#Last Modified: 2020-04-06 20:02:06
#Description:
# --------------------------------------------------



Date=`date "+%Y-%m-%d %H:%M:%S"`

if [ -f "~/.bash_profile" ]; then
    source  ~/.bash_profile
fi



run()
{
    salt_services
    ntp_check
}

salt_services ()
{
    salt_process="salt-minion"
    salt_pid=$(ps -ef|grep -v grep|grep "$salt_process"|wc -l)
    if [ $salt_pid -eq  0 ]; then

        [ -f "/bin/salt-minion" ] &&  service salt-minion start ||echo "no files"
        echo "$Date $salt_process  [INFO] starting " >> /var/log/salt/minion
    fi

}

ntp_check()
{
    ntpdate {{NTPSERVER}} >> /var/log/ntp.log 2>&1
}

run


